package org.jg.arkanoid.gameobjects.objectpanel;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;

import javax.swing.JPanel;

import org.jg.arkanoid.bonuses.Guns;
import org.jg.arkanoid.util.Vector;

public class GunsPanel extends JPanel
{
	private static final long serialVersionUID = 1L;
	private Guns guns;

	
	public GunsPanel(Guns guns)
	{
		this.guns = guns;
	}
	
	@Override
	public void paintComponent(Graphics g){
		super.paintComponent(g);
		Graphics2D g2 = (Graphics2D) g;

		setOpaque(false);
		
		Vector position = guns.getPosition();
		int width = guns.getWidth();
		int height = guns.getHeight();
		
		setBounds((int)position.getX(), (int)position.getY(), width, height);
		
		Rectangle2D rectangle = new Rectangle2D.Double(0, 0, width, height);
		g2.setPaint(guns.getColor());
		g2.fill(rectangle);
	}
	
}
